package com.tongji.admin
{
	import com.tongji.admin.command.BrandAdminCommand;
	import com.tongji.admin.command.CantavilAdminCMD;
	import com.tongji.admin.command.GoodsAdminCommand;
	import com.tongji.admin.command.GoodsTypeAdminCMD;
	import com.tongji.admin.command.TypeAdminCommand;
	import com.tongji.admin.event.BrandAdminEvent;
	import com.tongji.admin.event.CantavilAdminEvent;
	import com.tongji.admin.event.GoodsAdminEvent;
	import com.tongji.admin.event.GoodsTypeAdminEvent;
	import com.tongji.admin.event.TypeAdminEvent;
	import com.tongji.admin.model.BrandModel;
	import com.tongji.admin.model.CantavilModel;
	import com.tongji.admin.model.DictModel;
	import com.tongji.admin.model.GoodsModel;
	import com.tongji.admin.service.HouseDiyAdminService;
	import com.tongji.admin.service.HouseDiyService;
	import com.tongji.admin.view.BrandAdminMediator;
	import com.tongji.admin.view.BrandAdminView;
	import com.tongji.admin.view.CantavilAdminMediator;
	import com.tongji.admin.view.CantavilAdminView;
	import com.tongji.admin.view.DictAdminMediator;
	import com.tongji.admin.view.DictAdminView;
	import com.tongji.admin.view.GoodsAdminMediator;
	import com.tongji.admin.view.GoodsAdminView;
	import com.tongji.admin.view.GoodsBaseMediator;
	import com.tongji.admin.view.GoodsBaseView;
	import com.tongji.admin.view.MainView;
	import com.tongji.admin.view.MainViewMediator;
	import com.tongji.admin.view.PictureAdminMediator;
	import com.tongji.admin.view.PictureAdminView;
	import com.tongji.admin.view.compents.UploadComp;
	import com.tongji.admin.view.compents.UploadCompMediator;
	import com.tongji.admin.view.popup.AddPictureMediator;
	import com.tongji.admin.view.popup.AddPictureTitleWin;
	import com.tongji.admin.view.popup.AddTypeMediator;
	import com.tongji.admin.view.popup.AddTypeTitleWin;
	import com.tongji.admin.vo.Cantavil;
	
	import flash.display.DisplayObjectContainer;
	
	import org.robotlegs.mvcs.Context;
	
	/**
	 * 
	 * @author yanghanbing
	 * 2011/7/11
	 */
	
	public class HouseDiyAdminContext extends Context
	{
		public function HouseDiyAdminContext(contextView:DisplayObjectContainer=null, autoStartup:Boolean=true)
		{
			super(contextView, autoStartup);
		}
		
		override public function startup():void
		{			
			//Model
			injector.mapSingleton(BrandModel);
			injector.mapSingleton(CantavilModel);
			injector.mapSingleton(GoodsModel);
			injector.mapSingleton(DictModel);
			//Service
	        injector.mapSingleton(HouseDiyAdminService);
			injector.mapSingleton(HouseDiyService);
			//mapView
			mediatorMap.mapView(BrandAdminView, BrandAdminMediator);
			mediatorMap.mapView(CantavilAdminView, CantavilAdminMediator);
			mediatorMap.mapView(UploadComp, UploadCompMediator);
			mediatorMap.mapView(MainView, MainViewMediator);
			mediatorMap.mapView(GoodsAdminView, GoodsAdminMediator);
			mediatorMap.mapView(GoodsBaseView, GoodsBaseMediator);
			mediatorMap.mapView(PictureAdminView, PictureAdminMediator);
			mediatorMap.mapView(DictAdminView, DictAdminMediator);
			
			mediatorMap.mapView(AddPictureTitleWin, AddPictureMediator, null, false, false);
			mediatorMap.mapView(AddTypeTitleWin, AddTypeMediator, null, false, false);
			//mapEvent
			commandMap.mapEvent(BrandAdminEvent.ADD_A_BRAND, BrandAdminCommand);
			commandMap.mapEvent(BrandAdminEvent.GET_ALL_BRANDS, BrandAdminCommand);
			commandMap.mapEvent(BrandAdminEvent.UPDATE_BRANDS, BrandAdminCommand);
			commandMap.mapEvent(CantavilAdminEvent.ADD_A_CANTAVIL, CantavilAdminCMD);
			commandMap.mapEvent(CantavilAdminEvent.GET_ALL_CANTAVIL, CantavilAdminCMD);
			commandMap.mapEvent(GoodsTypeAdminEvent.GET_ALL_TYPES, GoodsTypeAdminCMD);
			commandMap.mapEvent(GoodsTypeAdminEvent.UPDATE_TYPES, GoodsTypeAdminCMD);
			commandMap.mapEvent(GoodsAdminEvent.ADD_A_GOODS, GoodsAdminCommand);
			commandMap.mapEvent(GoodsAdminEvent.GET_ALL_GOODS, GoodsAdminCommand);
            commandMap.mapEvent(TypeAdminEvent.ADD_TYPE, TypeAdminCommand);
			commandMap.mapEvent(TypeAdminEvent.GET_ALL_TYPE, TypeAdminCommand);
			commandMap.mapEvent(TypeAdminEvent.UPDATE_TYPEARRAY, TypeAdminCommand);
		}
	}
}